package com.recharge.domain.vo;

import com.google.gson.Gson;
import com.recharge.common.domain.BaseDO;
import com.recharge.common.util.DESUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class EncryptionCardDO extends BaseDO {

    /**
     * 密钥
     */
    @ApiModelProperty(value = "私钥")
    private String providerNo;

    private String encryptionData;

    private CardDO cardDO;



    public static void main(String[] args) {
        List<CardVoucherDO> cardVoucheres = new ArrayList<>();
        for(int i = 0; i < 100000; i++) {
            CardVoucherDO cardVoucherDO = new CardVoucherDO();

            cardVoucherDO.setVoucherNo("323422123212");
            cardVoucherDO.setVoucherPassword("1234567ABCD");
            cardVoucheres.add(cardVoucherDO);
        }
        CardDO cardDO = new CardDO();
        cardDO.setQuartity(100000);
        cardDO.setGoodsNo(10001);
        cardDO.setDenomination(50000L);
        cardDO.setProviderNo("60725862624");
        cardDO.setServiceProvider(1);
        cardDO.setRegionType(1);
        cardDO.setType(1);
        cardDO.setCardVoucheres(cardVoucheres);
        Gson gson = new Gson();
        String json = gson.toJson(cardDO);
        System.out.println(json);
        String encode = DESUtil.encrypt("sbHfO5/CmWER/csXW5vx/1s9Z+MO0T0K", json);
        System.out.println(encode.length() / 1024);

    }
}
